I don't find this inline example with artificial data particularly useful as documentation. I would just keep the line sentence: "Note that sparsity is supported by :class:`DecisionTreeClassifier`, i.e.  the input matrix X can be a sparse matrix both in the ``predict`` and ``fit`` methods." and then scratch the inline doctest.