The forward approximation as a mean field approximation for the Anderson and Many Body Localization transitions