All tooth bleaching techniques use essentially the same method. A peroxide gel is placed on the teeth which removes superficial stains and yellowing. Some teeth cannot be whitened by bleach (those darkened by internal trauma, stains due to medication like tetracycline and others); in these cases the tooth surface has to be covered up (usually with a veneer).
Home whitening kits or strips generally use lower-strength peroxide, but the effect is the same, they just take longer.
If you go the professional route, you can either get traditional tray bleaching or a light-enhanced technique. I am assuming that when you say "dentist" you are talking about in-office whitening, which is light-enhanced.
What does this mean? Dentists offer procedures such as ZOOM or BriteSmile, where the peroxide gel is applied, and then a light is shone on the teeth that activates the peroxide. I am not super familiar with BriteSmile, but I know ZOOM involves three or four 15-minute sessions, in which teeth can pretty much get as white as you want them to be. NB: Pure white teeth are not the goal, though you can get them that way. You want them to be a natural white, because too-white teeth look fake.
The best way to whiten your teeth depends on your budget, timeline and tolerance for pain and gum damage. Obviously, at-home whitening is cheapest, but it takes a long time, and when you do it yourself it's highly likely you will get the gel on your gums and soft tissue, which can be painful and/or damaging.
With in-office procedures like ZOOM, the dentist will take care to protect your gums, so you won't get the same extent of damage. Not saying that there will be zero gum damage; it's just going to be much less than if you do it yourself.
If you go with the take-home tray option, there will be less chance of damage because the trays will be custom-fitted to your mouth. In my experience, though, there can be some leakage of the peroxide gel onto the gum surface.
With any kind of bleaching, there can be tooth sensitivity as well. And though dentists say the peroxide is non-harmful, in my experience it tends to erode tooth enamel slightly. If you bleach, make sure to use a fluoride rinse regularly to help maintain the enamel structure.