From a PLOS Medicine online study:
Depression is associated with increased odds of dementia, even more than 20 years after diagnosis of depression, and the association remains after adjustment for familial factors. Further research is needed to investigate whether successful prevention and treatment of depression decrease the risk of dementia.
The risk of dementia is increased for decades after a diagnosis of depression, where those diagnosed with especially severe depressions are at increased risk.

Dementia is common among the elderly, causing severe individual suffering as well as societal strain. As the proportion of people aged 65 years and above is rapidly increasing in the world population, the number of individuals with dementia is expected to double within 20 years, and this condition was estimated to have a worldwide cost of US$604 billion in 2010. Effective treatments for dementia remain scarce; however, a preventive approach may be possible through the identification of high-risk individuals and potentially modifiable risk factors.