About the double ionization of ammonia and carbon dioxide. A comparison between photoionization and electron impact