'Extracts two selected columns from sparse matrix.
GH-2260'

def sparse_to_dense(self, data, init=False):

    def discretizer(data):
        if any((attr.is_continuous for attr in chain(data.domain, data.domain.metas))):
            discretize = Discretize(method=EqualFreq(n=4), remove_const=False, discretize_classes=True, discretize_metas=True)
            return discretize(data)
        return data
    if ((not data.is_sparse()) and (not init)):
        return self.discrete_data
    if data.is_sparse():
        attrs = {self.attr_x, self.attr_y}
        new_domain = data.domain.select_columns(attrs)
        data = Table.from_table(new_domain, data)
        data.X = data.X.toarray()
    return discretizer(data)
