Living a healthy lifestyle may help offset a person's genetic risk of dementia, according to new research.