def METHOD_NAME(matrix):
    """
    Convert a sparse matrix to a dense one if that would result in less overall
    memory usage
    This isn't primarily about storage space as once compressed there isn't
    much difference between the two forms, but the smaller representations are
    faster to work with when summing.
    """
    if get_dense_memory_usage(matrix) < get_sparse_memory_usage(matrix):
        return matrix.toarray()
    else:
        return matrix