The correlation between superconductivity and ferromagnetism in superconductor-ferromagnet heterostructures