We study the evolutionary Prisoner's Dilemma on two social networks substrates obtained from actual relational data. We find very different cooperation levels on each of them that cannot be easily understood in terms of global statistical properties of both networks. We claim that the result can be understood at the mesoscopic scale, by studying the community structure of the networks. We explain the dependence of the cooperation level on the temptation parameter in terms of the internal structure of the communities and their interconnections. We then test our results on community-structured, specifically designed artificial networks, finding a good agreement with the observations in both real substrates.