We have developed a prestack inversion algorithm that combines a discrete cosine transform (DCT) reparameterization of data and model spaces with a convolutional neural network (CNN). The CNN is trained to predict the mapping between the discrete cosine-transformed seismic data and the discrete cosine-transformed 2D elastic model. A convolutional forward modeling based on the full Zoeppritz equations constitutes the link between the elastic properties and the seismic data. The direct sequential cosimulation algorithm with joint probability distribution is used to generate the training and validation data sets under the assumption of a stationary nonparametric prior and a Gaussian variogram model for the elastic properties. The DCT is an orthogonal transformation that we used as an additional feature extraction technique that reduces the number of unknown parameters in the inversion and the dimensionality of the input and output of the network. The DCT reparameterization also acts as a regularization operator in the model space and allows for the preservation of the lateral and vertical continuity of the elastic properties in the recovered solution. We also implement a Monte Carlo simulation strategy that propagates onto the estimated elastic model the uncertainties related to noise contamination and network approximation. We focus on synthetic inversions on a realistic subsurface model that mimics a real gas-saturated reservoir hosted in a turbiditic sequence. We compare the outcomes of the implemented algorithm with those provided by a popular linear inversion approach, and we also evaluate the robustness of the CNN inversion to errors in the estimated source wavelet and to erroneous assumptions about the noise statistic. Our tests confirm the applicability of our proposed approach, opening the possibility of estimating the subsurface elastic parameters and the associated uncertainties in near real time while satisfactorily preserving the assumed spatial variability and the statistical properties of the elastic parameters.