docs: def from_data(cls, data):
          """ Create a dataset from an array of data, infering the dimension from the datapoint """
          if len(data) == 0:
              raise ValueError("data array is empty.")
          dim_x, dim_y = len(data[0][0]), len(data[0][1])
          dataset = cls(dim_x, dim_y)
          for x, y in data:
              assert len(x) == dim_x and len(y) == dim_y
              dataset.add_xy(x, y)
          return dataset