These headaches are severe, and should prompt you to see a doctor
right away. Headaches area rarely associated with dreaming. There is no reason why a dream should cause a headache. It may be that the headache slowly awakens you from sleep, which causes you to remember the dream you were having .
Regardless of their association, your headaches need to be evaluated. This is because I am concerned about the fact that they awaken you from sleep. The common headaches that include migraine type headaches and tension type headaches typically do not awaken people from sleep, and they don't prevent people from being able to lie down or close their eyes. Headaches that awaken people from sleep can be from a many different conditions including temporal arteritis, a mass effect, or possibly from a type of headache called a cluster headache.
I suggest that you schedule an appointment with a neurologist
. I think you need to see a specialist about these headaches because of the fact that they awaken you from sleep. The neurologist will take a detailed history of your headaches, perform a comprehensive neurological exam, and possibly order some imaging of your head which may include an MRI
. Hopefully this will help you get to the bottom of your headaches.