There were both similarities and differences between the ideologies behind these two wars.
Both of the wars were clearly justified by the idea of American superiority. This superiority was seen both in societal and in racial terms. In other words, both wars were underpinned by the idea that Americans were racially superior to the people of Latin America and that Americans had a better society (government, religion, etc) than was present in Latin America.
The major difference is that the ideology of 1896 was more focused on the alleged need to help the people who were being conquered. There was no real idea of taking up the "white man's burden" in the conquest of Mexico. By 1896, there was clearly a felt need to justify imperialism as something that would work to the benefit of those who were conquered.