Using full 3D, it's pretty easy. You're simply moving & rotating the camera relative to a textured quad or flat mesh.
Using pixels only, it's more challenging. The mapping formula is available on Wikipedia:
Mode 7 graphics are generated for each pixel by mapping screen coordinate \$r\$ to background coordinate \$r'\$ using an affine transformation and sampling the corresponding background color. The 2D affine transformation is specified for each scanline by 6 parameters; \$a,b,c, d\$ define the matrix \$M\$, while \$x_0\$ and \$y_0\$ define the vector \$r_0\$ locates the origin of the matrix transformation and is related to a translation vector. Specifically, screen coordinate \$r\$is translated to the origin coordinate system, the matrix is applied, and the result is translated back to the original coordinate system to obtain \$r'\$. In 2D matrix notation, this is written as:
a & b \\
c & d
All arithmetic is carried out on 16-bit signed fixed point numbers, while all offsets are limited to 13 bits. The radix point is between bits 7 and 8.
If you're looking at the historical, pixel manipulation method, it's worth mentioning that the original implementation had some rounding errors that resulted in visual artifacts - the output looked somewhat blocky & had visual artifacts:
The above was taken from this video clip.
As to which approach you should use - only you can answer that. That depends on your time, interest, skills, constraints and other things not covered in the question & beyond the scope of GDSE recommendations. My advice would be to consider the pros & cons of those factors & choose accordingly.