Yup, you need motion graphics software that has a "motion tracking" feature (also called tracking or match-moving). Without getting into the high-end packages, some off-the-shelf software that does that includes:
1. Adobe After Effects
2. Apple Motion
3. Sony Vegas
4. HitFilm
Basically, you pick a point on the target (such as a person's nose) and create a motion track for that (it tracks the point frame-by-frame). Then you add in your graphics (ex. thought bubble image file) and the software calculates the math to make your thought bubble follow the target. Sample from Youtube:
http://www.youtube.com/watch?v=X9jXor_gq1g
You can do tracking in either in 2D or 3D, depending if you want the effect to grow/shrink as they move closer/away from the camera. You can also do a static image, like a Photoshop image of a thought bubble with text in it, or do an animated graphic where the thought bubble pops out and the words fill in like a typewriter. Lots of options depending on how deeply you want to get into it. Simple way is to do 2D tracking with a non-animated image, not much work required for that.