Ensemble equivalence for dense graphs