@classmethod
def from_data(cls, data, labels=None, feature_names=None, label_names=None,
    static=True):
    """
    Converts two arrays or a sparse matrix data and its associated label array to Dataset.

    Parameters
    ----------
    data : array or scipy 2-D sparse matrix of shape [n_samples, n_features]
    labels : array of shape [n_samples], optional
    feature_names : array of shape [n_features], optional
    label_names : array of shape [n_labels], optional
    """
    if hasattr(data, 'todense'):
        return cls.from_matrix(data, labels, feature_names, label_names, static
            )
    else:
        return cls.from_array(data, labels, feature_names, label_names, static)
