Efficient training-image based geostatistical simulation and inversion using a spatial generative adversarial neural network