One charity said work was under way in the south Wales valleys to encourage people to make better informed decisions about their health.
The Welsh Government said it was “determined” to address health inequalities.
The report showed that 333 people died from dementia and Alzheimer’s in Wales’ least deprived areas in 2016, compared to 284 deaths in the most deprived areas.
Meanwhile, there were 397 heart disease deaths in the most deprived areas in 2016 – compared to 294 in the most affluent areas.
Alzheimer’s Society Cymru director Sue Phelps said health and social care staff were “increasingly recognising dementia as a cause of death as opposed to a natural part of ageing”.
“They also reflect that decreased mortality for other conditions is leading to more people living longer and thus becoming at higher risk for developing dementia as age is a determining risk factor; this is particularly the case in more affluent areas,” she said.
“As there is no cure for the condition, it is essential that people have access to the right support and services to help them live as well as possible with dementia and that research into better care, and treatment is of the highest priority.”
Dr Bob Baron, a trustee of the charity Welsh Hearts, said risk factors for a person developing heart disease included poor diet, a lack of exercise and smoking.
“We need to give people a positive message that if they take steps to change their lifestyle, for instance by stopping smoking, then it reduces their risk immediately,” he said.
“Work has been done in deprived areas like the south Wales valleys to get this positive message across and lifestyles are improving.”
The ONS also gave breakdowns according to gender, showing the leading causes of death for men and women remain the same as 2015.
Heart disease was the biggest killer of men in Wales last year, while dementia and Alzheimer’s was the biggest killer of women.
A Welsh Government spokesman said: “Despite overall improvements in life expectancy, there is a significant difference in rates of avoidable mortality between the least and most deprived socioeconomic groups.
“We are determined to do everything we can to address inequalities in health outcomes between Wales’ most and least deprived communities.
“Our national plan for primary care services in Wales sets out clear and specific actions to tackle inequalities in health outcomes.
“We have supported two projects to identify people from deprived communities in south east Wales at risk of cardiovascular disease, and then supporting these people to reduce that risk. We are expanding these approaches across Wales.”