<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_df(cls, data, entities=None, source='contrast'):
        ''' Create a Collection from a pandas DataFrame.

        Args:
            df (DataFrame): The DataFrame to convert to a Collection. Each
                column will be converted to a SimpleVariable.
            entities (DataFrame): An optional second DataFrame containing
                entity information.
            source (str): The value to set as the source for all Variables.

        Returns:
            A BIDSVariableCollection.
        '''
        variables = []
        for col in data.columns:
            _data = pd.DataFrame(data[col].values, columns=['amplitude'])
            if entities is not None:
                _data = pd.concat([_data, entities], axis=1, sort=True)
            variables.append(SimpleVariable(name=col, data=_data, source=source))
        return BIDSVariableCollection(variables)