A review and meta-analysis of previous studies suggests that headache (any headache) is associated significantly with a higher risk of developing dementia. The authors suggest that further research would be advisable to confirm and clarify their findings.
Wang, J. Xu, W. [and] Sun, S. [et al] (2018). Headache disorder and the risk of dementia: a systematic review and meta-analysis of cohort studies. The Journal of Headache and Pain. October 11th 2018; 19(1): 95.