A reduction algorithm for approximating a (nonmetric) dissimilarity by a tree distance