It is still not clear. Evidences have shown that anxiety can lead to headaches while the other way around can be true as well.
Headaches are among the symptoms of some types of anxiety, such as generalized anxiety disorder (GAD). If doctors try to find out whether you have GAD or not, they look for signs like headaches. However, scientists don't know yet whether headaches lead to anxiety or the other way around. Evidences have suggested that it can be either way. For example, researchers found that those who live with migraines have higher chances of developing anxiety. But they also discovered that people who suffer only a few headaches are likely to get more headaches if they later develop anxiety.
Keyword: anxiety headache