Magnetic particle imaging (MPI) is a fast emerging biomedical imaging modality that exploits the nonlinear response of superparamagnetic iron oxide (SPIO) nanoparticles to image their spatial distribution. Previously, various scanning trajectories were analyzed for the system function reconstruction (SFR) approach, providing important insight regarding their image quality performances. While Cartesian trajectories remain the most popular choice for x-space-based reconstruction, recent work suggests that non-Cartesian trajectories such as the Lissajous trajectory may prove beneficial for improving image quality. In this work, we propose a generalized reconstruction scheme for x-space MPI that can be used in conjunction with any scanning trajectory. The proposed technique automatically tunes the reconstruction parameters from the scanning trajectory, and does not induce any additional blurring. To demonstrate the proposed technique, we utilize five different trajectories with varying density levels. Comparison to alternative reconstruction methods show significant improvement in image quality achieved by the proposed technique. Among the tested trajectories, the Lissajous and bidirectional Cartesian trajectories prove more favorable for x-space MPI, and the resolution of the images from these two trajectories can further be improved via deblurring. The proposed fully automated gridding reconstruction can be utilized with these trajectories to improve the image quality in x-space MPI.