Clues on galaxy and cluster formation from their scaling relations