You can do this with computed columns. Add the "leastId" and "greatestId" columns and then create the index on them:
alter table relationships
add leastId as (case when fromuserid < touserid then fromuserid else touserid end);
alter table relationships
add greatestId as (case when fromuserid < touserid then touserid else fromuserid end);
create unique index relatinonships_leastId_greastestId_Combination
on relationships(leastId, greatestId, combination);