I am not a doctor but I do have personal experience with anxiety attacks and nightmares. It is possible that they could be related but only you can tell, think about what the nightmares are about, is this something you are nervous or stressed out about in real life? Also nightmares may not be exactly literal.
For instance I used to have a nightmare on a regular basis that I was swimming under water and freddy crouger was chasing me. Before this nightmare began I had almost drowned in the ocean and although I was with a large group of people, no one noticed or tried to help me. After I dealt with my fear or drowning my nightmare went away. So my dream was actually about drowning but it was about dying under water so it wasnt exactly literal.
One thoery about dreams is that the worries that we do not deal with during the day will come out in our dreams. If this is becoming a regular problem for you I would suggest you try before you go to bed try writing down the stressful things of the day and how you can make it a little better that way you dont have to worry about it in your sleep. Also, try to think outside of the box when you have a nightmare and see if it relates to anything you are worried about in real life.
As far as your anxiety attack it may just be a one time thing but if it isnt you can try yoga, meditation, breathing exercises and journaling. This things have worked for mw in the past. You can try it before you start your day or before bed and find out what and when it works best for you. If it gets really bad there is medication you can take but atleast for me the medication doesnt work as well as the other things I have mentioned.
I do not know if it can lead to anything dangerous, I just wanted to give you some suggestions that have worked for me to help you minimize the problem. The biggest thing is to just acknowledge the things that are upsetting, stressful, etc.. If you ignore them they will find other ways to come out.