<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_timeseries(cls, timeSeries):
 """Create a new Matrix instance from a TimeSeries or MultiDimensionalTimeSeries :param TimeSeries timeSeries: The TimeSeries, which should be used to create a new Matrix. :return: A Matrix with the values of the timeSeries. Each row of the Matrix represents one entry of the timeSeries. The time of an entry is ignored in the matrix. :rtype: Matrix :raise: Raises an :py:exc:`ValueError`, if the timeSeries is empty. """

        width = 1

        if isinstance(timeSeries, MultiDimensionalTimeSeries):
            width = timeSeries.dimension_count()

        matrixData = [[] for dummy in xrange(width)]

        for entry in timeSeries:
            for col in xrange(1, len(entry)):
                matrixData[col - 1].append(entry[col])
        if not matrixData[0]:
            raise ValueError("Cannot create Matrix from empty Timeseries")
        mtrx = Matrix.from_two_dim_array(len(matrixData), len(matrixData[0]), matrixData)

        # mtrx.initialize(matrixData, rowBased=False)
        return mtrx