Are 'Dr' for medical doctor used in the same sense as a PhD? My dentist is Dr. Wang and my physician is Dr. O'Connor but I also refer to my professor as Dr. 

Are these the same titles? Did they all achieve what it took to get a Dr. title?
While all those titles share the same linguistic roots, obviously, the meaning is somewhat different. When referring to a Ph.D., term doctor is used in the context of general knowledge acquisition. That is why the full title is doctor of philosophy, where philosophy implies "love of wisdom". On the other hand, a medical doctor (M.D.) or Doctor of Osteopathic medicine (D.O.) title or one of dental doctor titles refers to a specialist in one or more areas of medicine. A relatively popular alternative term for medical doctor is physician, which some people might confuse with with physicist. The origins of the word "physician" and its relation to the word "doctor" are discusses in this interesting article in Science Friday.

The original meaning of the word "doctor" as "license to teach" has likely been transferred to the medicine knowledge domain IMHO due to the important role of one of the cornerstones of science that medicine played at that particular time period and place (medieval Europe). You may also find additional interesting information in this related discussion on StackExchange.