How to simulate a mosfet from a datasheet in ngspice
How do I simulate a circuit containing a Mosfet, and transform the
  values in the datasheet of the mosfet into ngspice.


First of all pick a MOSFET from within your sim that is already present and supported. Try this out to make sure everything seems to work.

Second, double-click (or whatever mechanism is needed) to open that MOSFET part so you can inspect the parameters. Can you edit them - you should be able to do this.

Thirdly, forget about trying to convert data sheet values to spice parameters - just go look for the model of the device you want to use and change the values by editing them. Sometimes models are written down in data sheets but, more often than not you have to dig around.

Some sims will allow you to paste the whole ascii model text into a special area and this will overwrite the model parameters contained in the device you chose. I don't use ngspice so I can only guess at this bit and what facilities it has.

The spice model for the STN2NF10 is found on this page: -

*****************************************************
*     Model Generated by STmicroelectronics         *
*             All Rights Reserved               *
*      Commercial Use or Resale Restricted          *
*****************************************************
* CREATION DATES: 21-04-2006                        *
*                                                   *
* POWER MOSFET Model (level 3)                      *
*                                                   *
* EXTERNAL PINS DESCRIPTION:                        *
*                                                   *
* PIN 1 -&gt; Drain                                    *
* PIN 2 -&gt; Gate                                     *
* PIN 3 -&gt; Source                                   *
*                                                   *
*                    ****C****                      *
*            **********************                 *
*     ***************************************       *
*  PARAMETER MODELS EXTRACTED FROM MEASURED DATA    *
*              &lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&lt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;&gt;               *
*     ***************************************       *
*   THIS MODEL CAN BE USED AT TEMPERATURE: 25 °C    *
*                                                   *
*****************************************************

* MODELLING FOR STN2NF10

.SUBCKT STN2NF10 1 2 3
LG 2 4  7.5E-09
LS 12 3 7.5E-09
LD 6 1  4.5E-09
RG 4 5  4.001
RS 9 12 0.325E-02
RD 7 6  0.142
RJ 8 7  0.445E-03
CGS 5 9   0.419E-09
CGD 7 10  0.467E-09
CK  11 7  0.307E-10
DGD 11 7 DGD
DBS 12 6 DBS
DBD  9 7 DBD
MOS  13 5 9 9 MOS L=1u W=1u
E1  10 5 101 0 1
E2  11 5 102 0 1
E3  8 13 POLY(2) 6 8 6 12 0 0 0 0  0.321
G1  0 100 7 5 1u
D1  100 101  DID
D2  102 100  DID
R1  101 0  1MEG
R2  102 0  1MEG
.ENDS STN2NF10

.MODEL MOS NMOS
+ LEVEL = 3
+ VTO   = 4.184
+ PHI   = 0.827
+ IS    = 0.1E-12
+ JS    = 0
+ THETA = 0.995
+ KP    = 15.084
+ ETA   = 0.199E-02

.MODEL DGD D
+ IS    = 0.1E-12
+ CJO   = 0.171E-10
+ VJ    = 0.754
+ M     = 0.367
.MODEL DBD D
+ IS    = 0.1E-12
+ CJO   = 0.202E-10
+ VJ    = 0.755
+ M     = 0.335
.MODEL DBS D
+ IS    = 0.1E-12
+ BV    = 117
+ N     = 1
+ TT    = 0.699E-07
+ RS    = 0.505E-02
.MODEL DID D
+ IS    = 0.01E-12
+ RS    = 0
+ BV    = 127

* END OF MODELLING