<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def from_dataset(cls, dataset, constraints = (), **kwargs):
 """Construct a optimized inverse model from an existing dataset. A LWLR forward model is constructed by default. """

        fm = LWLRForwardModel(dataset.dim_x, dataset.dim_y, **kwargs)
        fm.dataset = dataset
        im = cls.from_forward(fm, constraints = constraints, **kwargs)
        return im