I don't think they just 'grow out of it' although I'm sure some kids do -- but I'm someone who has had severe anxiety/panic attacks my whole life.
I wouldn't ordinarily suggest this but could they sedate her to fill the cavities? (If you actually have to fill them -- I know I read on the Dental board that there are sometimes other options)... I think practicing & preparing ahead of tims is good & could be complemented by learning relaxation techniques. She could learn to breathe deeply, meditate on a little scene or story, relax all her muscles, etc. These are things you could teach her but I think it would help if you could figure out exactly what's triggering the panic attacks. For ex., maybe it's the metal tools, they might look scary to her, so you'd want to let her explore those tools a lot to feel comfortable with them. Or maybe it's having a stranger touch her, in which case maybe more time at the beginning of the appointment for the doctor/dentist to talk & play with her a bit if they're willing to do this. Or maybe it's something totally different, like the smell of the room or the lighting.
Co-sleeping is really wonderful when your child actually SLEEPS!!