Photometric redshifts for the Kilo-Degree Survey: Machine-learning analysis with artificial neural networks